import { createI18n } from 'vue-i18n'
import zhCh from './locales/zh-ch'
import enUs from './locales/en-us'
import store from '@/store'
const messages = {
  en: { name: 'en', ...enUs },
  'zh-cn': { name: 'zh-cn', ...zhCh }
}
const getLanguage = () => {
  return store && store.state && store.state.language
}
console.log(getLanguage())
const i18n = createI18n({
  legacy: false,
  globalInjection: true,
  silentTranslationWarn: true,
  silentFallbackWarn: true,
  locale: getLanguage(),
  fallbackLocale: 'zh-cn',
  messages: messages
})
export default i18n
